<%@page import="cn.school.entity.Subject"%>
<%@page import="java.util.List"%>
<%@page import="cn.school.service.Service3"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%-- <%
List<Subject> datas=(List<Subject>)request.getAttribute("list");
int total=(Integer)request.getAttribute("total");
int pageNo=(Integer)request.getAttribute("pageNo");
%> --%>
<table border="1" cellpadding="0" cellspacing="0">

<tr>
<td>课程编号</td>
<td>课程名称</td>
<td>小时</td>
<td>年级编号</td>
</tr>
<%-- <% for(Subject s:datas){ %> --%>
<c:forEach items="${requestScope.list}" var="subject" varStatus="s">
<tr <c:if test="${s.index%2==0 }">style='background-color:pink'</c:if>>
<td>${subject.id }</td><td>${subject.subjectName }</td>
<td>${subject.classHour }</td><td>${subject.gradeId }</td>
</tr>
<%-- <%} %> --%>
</c:forEach>
</table>

<p aligh="center">
<a href="SubjectServlet?pageNo=1">首页</a>
<%-- <%
if(pageNo>1){
%> --%>
<c:if test="${requestScope.pageNo>1 }">
<a href="SubjectServlet?pageNo=${requestScope.pageNo-1 }">上一页</a>
</c:if>
<%-- <%} %> --%>
<%-- <%
if(total>pageNo){
%> --%>
<c:if test="${requestScope.total>requestScope.pageNo }">
<a href="SubjectServlet?pageNo=${requestScope.pageNo+1 }">下一页</a>
<%-- <%} %> --%>
</c:if>
<a href="SubjectServlet?pageNo=${requestScope.total }">尾页</a>
</p>
</body>
</html>